4505cdd890bebffa6834db2c553a95d0a8186647,hadoop-core-1.0.4/src/main/java/org/apache/hadoop/security/UserGroupInformation.java,UserGroupInformation,getCurrentUser,#,449

Before Change


  static UserGroupInformation getCurrentUser() throws IOException {
    AccessControlContext context = AccessController.getContext();
    Subject subject = Subject.getSubject(context);
    return subject == null ? getLoginUser() : new UserGroupInformation(subject);
  }

  /**

After Change


    AccessControlContext context = AccessController.getContext();
    Subject subject = Subject.getSubject(context);
    // As the Apache Karaf provides the Subject by default, we need to make sure hadoopcan get the User.class information first
    if (subject != null && subject.getPrincipals(User.class).iterator().hasNext()) {
        return new UserGroupInformation(subject);
    }
    return getLoginUser();
  }

  /**